<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>用户登录</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link href="/bootstrap/css/bootstrap.min.css" rel="stylesheet">
    <script src="/jquery/jquery-2.1.3.js"></script>
    <script src="/common/common.js"></script>
    <script src="/bootstrap/js/bootstrap.min.js"></script></head>
<body>
<div class="container">
    <section class="loginBox row-fluid">
        <section class="span7 middle">
            <h2>用户注册</h2>
            <table>
                <tr>
                    <td><span>用户名:  </span></td><td><input type="text" id="username"/></td>
                </tr>
                <tr>
                    <td><span>密码:</span></td><td><input type="text" id="password"/></td>
                </tr>
                <tr>
                    <td><span>重复密码:</span></td><td><input type="text" id="password2"/></td>
                </tr>
                <tr>
                    <td><span>邮箱:    </span></td><td><input type="text" id="email"/></td>
                </tr>
                <tr>
                    <td><span>联系电话:</span></td><td><input type="text" id="phone"/></td>
                </tr>
            </table>
            <section class="row-fluid">
                <section class="span1"><input type="button" value=" 注册 " class="btn btn-primary" onclick="reg()"></section>
            </section>
        </section>
    </section><!-- /loginBox -->
</div> <!-- /container -->
</body>
<script>
    function reg(){
        var username = $("#username").val();
        var password = $("#password").val();
        var password2 = $("#password2").val();
        var email = $("#email").val();
        var phone = $("#phone").val();

        if(username==null||password==null||username==""||password==""){
            alert('请输入用户名密码!');
            return;
        }
        if(password != password2){
            alert('密码不一致');
            return;
        }

        var param = new Object();
        param.username = username;
        param.password = password;
        param.password2 = password2;
        param.email = email;
        param.phone = phone;
        var data = postContent("/doRegist",param,false,null);
        if(data!=null){
            alert('注册成功，请重新登录!');
            window.location.href = "/login.html";
        }
    }
</script>
</html>
